<?php

class users_cron {
	
	public function __construct () {}
	
	public function __default () {}
	
	public function registration () {
		$oTypeRegistration = TypesController::getInstance()->getTypeByName ('registration');
		$objectsController = ObjectsController::getInstance ();
		$days = (int) Regedit::getInstance()->get ('//modules/users/days_for_registration');		
		
		$sel = new Selection;
		$sel->addType ($oTypeRegistration);
		$sel->addFilter ('date', (time() - $days*86400), '<');
		
		$aObjects = $objectsController->getObjectsList($sel->getList ());
		
		foreach ($aObjects as $object) {
			$object->delete ();
		}
	}
	
}